
/* ================================================
   置顶功能
================================================ */
$('.to-top').toTop();
$('.to-top').addClass('css-theme-color fa fa-arrow-circle-up fa-3x');


/* ================================================
   PWA 离线化
================================================ */
if (typeof navigator.serviceWorker !== 'undefined') {
   navigator.serviceWorker.register('https://gitee.com/cpfree/resources/raw/master/docsify/js/pwa.js')
}


/* ================================================
   随机更改首页面图片方法
================================================ */
(function randomChangeCoverBg() {
   var r = document.querySelector(':root');
   var random = Math.floor(Math.random() * 10);
   r.style.setProperty('--bg-bg', 'url(https://gitee.com/cpfree/resources/raw/master/docsify/img/cover/cover-' + random + '.jpg) center center / cover');
})();
